package com.kgc.storeconsumer.controller;

import com.kgc.basic.util.ResponseMsg;
import com.kgc.store.pojo.OutStoreDetail;
import com.kgc.store.pojo.QualityDetail;
import com.kgc.storeconsumer.feign.QualityDetailFeign;
import com.kgc.storeconsumer.feign.QualityFeign;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Controller
@CrossOrigin("*")
@RequestMapping("/qualityDetail")
public class QualityDetailController {

    private Logger logger = LoggerFactory.getLogger(getClass());
    @Autowired
    private QualityDetailFeign qualityDetailFeign;

    @RequestMapping("getQualityDetailList")
    @ResponseBody
    public ResponseMsg getQualityDetailList(String qualityCode){
        logger.info("QualityDetailController getQualityDetailList qualityCode:"+qualityCode);
        ResponseMsg msg =qualityDetailFeign.getQualityDetailList(qualityCode);
        logger.debug("QualityDetailController getQualityDetailList msg:"+msg);
        return msg;
    }

    @RequestMapping("delQualityDetailByQualityCode")
    @ResponseBody
    public ResponseMsg delQualityDetailByQualityCode(String qualityCode){
        logger.info("QualityDetailController delQualityDetailByQualityCode qualityCode:"+qualityCode);
        ResponseMsg msg =qualityDetailFeign.delQualityDetailByQualityCode(qualityCode);
        logger.debug("QualityDetailController delQualityDetailByQualityCode msg:"+msg);
        return msg;
    }

    @RequestMapping("addQualityDetail")
    @ResponseBody
    public ResponseMsg addQualityDetail(@RequestBody QualityDetail qualityDetail){
        logger.info("QualityDetailController addQualityDetail qualityDetail:"+qualityDetail);
        ResponseMsg msg =qualityDetailFeign.addQualityDetail(qualityDetail);
        logger.debug("QualityDetailController addQualityDetail msg:"+msg);
        return null;
    }
}
